import socket,framebuf,time,machine
from machine import I2C,Pin
from ssd1306 import SSD1306_I2C
import wifi

wifi.oldconnect()
i2c = I2C(scl = Pin(4),sda = Pin(5))
display = SSD1306_I2C(128,64,i2c)
host = '192.168.31.120'
port = 8080

s = socket.socket()
addr = (host,port)
s.connect(addr)

i = 0

while True:
    data1 =s.recv(1024)
    data2=s.recv(1024)
    data=data1+data2
    if len(data) > 10:#其实这个要不要无所谓，没影响
        fbuf = framebuf.FrameBuffer(bytearray(data),88,64,framebuf.MONO_HLSB)#这个参数不能换
        display.fill(0)
        display.blit(fbuf,19,0)
        display.show()
        del data,data1,data2
        
